//
//  WJBaseTableViewCell.m
//  WJBSApp
//
//  Created by dllo on 16/7/13.
//  Copyright © 2016年 王景伟. All rights reserved.
//

#import "WJBaseTableViewCell.h"

@implementation WJBaseTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
            
            self.contentView.backgroundColor = FORBLACKCOLOR;
            
        }else{
            
            self.contentView.backgroundColor = [UIColor whiteColor];
            
        }
        // 创建观察者
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
    }
    return self;
}

- (void)changeColor:(NSNotification *)cation
{
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
        
        self.contentView.backgroundColor = FORBLACKCOLOR;
        
    }else{
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        
    }
    
}

// 销毁观察者
- (void)dealloc{
    
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [super dealloc];
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
